package 动态规划;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 最长上升序列
 */
public class Algo300 {

    public static int lengthOfLIS(int[] nums) {
        int[] dp = new int[nums.length];
        Arrays.fill(dp, 1);
        for (int i = 1; i < dp.length; i++) {
            for (int j = 0; j < i; j++) {
                if(nums[j]<nums[i]) {
                    dp[i] = Math.max(dp[i], dp[j]+1);
                }
            }
        }
        int length = -1;
        for (int i = 0; i < dp.length; i++) {
            length = Math.max(dp[i], length);
        }
        return length;
    }


    public static int maxEnvelopes(int[][] envelopes) {
        //排序
        for (int i = 0; i < envelopes.length; i++) {
            for (int j = i; j < envelopes.length; j++) {
                if(envelopes[j][0] > envelopes[i][0]) {

                }
            }
        }
        return 0;
    }

    public static void main(String[] args) {
        int[] nums = {10,9,2,5,3,7,101,18};
        int[] nums2 = {0,1,0,3,2,3};
        int[] nums3 = {7,7,7,7,7,7,7};
        int[] nums4 = {1,3,6,7,9,4,10,5,6};
        System.out.println(lengthOfLIS(nums4));
    }
}
